<template>
  <div class="info-box">
    <div class="info-image">
      <div class="info-box">
        <div class="info-basic">
          <IconTitle title="基本信息" imgUrl="yunwei">
            <span class="slot">品牌管理</span>
          </IconTitle>
          <b>{{ detailInfo.deviceName }}</b>
          <div class="tag-box">
            <el-tag size="mini">特种设备</el-tag>
            <el-tag size="mini">特种设备</el-tag>
            <el-tag type="warning" size="mini">生产二部</el-tag>
            <el-tag type="danger" size="mini">故障风险预测 2点</el-tag>
            <el-tag type="danger" size="mini">设备异常 2条</el-tag>
          </div>
          <div class="equi-box">
            <div class="equi-item">
              <span class="title">设备状态</span>
              <div class="spec-item">
                <div class="circle-blue"></div>
                <p>{{ detailInfo.status }}</p>
              </div>
            </div>
            <div class="equi-item">
              <span class="title">使用状态</span>
              <div class="spec-item">
                <div class="circle-green"></div>
                <p>{{ detailInfo.useStatus }}</p>
              </div>
            </div>
            <!-- <div class="equi-item">
              <span class="title">设备等级：</span>
              <div class="spec-item">
                <div class="circle-purple"></div>
                <p></p>
              </div>
            </div> -->
            <div class="equi-item">
              <span class="title">设备编号</span>
              <div class="item">{{ detailInfo.deviceNum }}</div>
            </div>
            <div class="equi-item">
              <span class="title">资产编号</span>
              <div class="item">{{ detailInfo.assetNum }}</div>
            </div>
            <div class="equi-item">
              <span class="title">序列号</span>
              <div class="item">KYUAOA00923876813</div>
            </div>
            <div class="equi-item">
              <span class="title">设备名称</span>
              <div class="item">{{ detailInfo.deviceName }}</div>
            </div>
            <div class="equi-item">
              <span class="title">电子标签</span>
              <div class="item">{{ detailInfo.electronicLabel }}</div>
            </div>
            <div class="equi-item">
              <span class="title">单位</span>
              <div class="item">{{ detailInfo.unit }}</div>
            </div>
            <div class="equi-item">
              <span class="title">设备类别</span>
              <div class="item">{{ detailInfo.category }}</div>
            </div>
            <div class="equi-item">
              <span class="title">规格型号</span>
              <div class="item">{{ detailInfo.specification }}</div>
            </div>
            <div class="equi-item equi-item-big">
              <span class="title">品牌</span>
              <div class="item">{{ detailInfo.brandName }}</div>
            </div>
            <div style="width: 100%"></div>
            <div class="equi-item equi-item-big">
              <span class="title">供应商</span>
              <div class="item spec-item-long" :title="detailInfo.supplierName">
                <img
                      class="acount-svg"
                      src="/images/acount3.png"
                    />
                {{ detailInfo.supplierName }}
              </div>
            </div>
            <div style="width: 100%"></div>
            <div class="equi-item">
              <span class="title">设备来源：</span>
              <div class="item">KYUAOA555550923876813</div>
            </div>
            <div class="equi-item">
              <span class="title">采购金额：</span>
              <div class="item">{{ detailInfo.purchaseAmount }}</div>
            </div>
            <div class="equi-item">
              <span class="title">购置日期：</span>
              <div class="item">{{ detailInfo.purchaseDate }}</div>
            </div>
            <div class="equi-item">
              <span class="title">保修期至：</span>
              <div class="item">{{ detailInfo.warrantyDate }}</div>
            </div>
            <div class="equi-item">
              <span class="title">启用日期：</span>
              <div class="item">{{ detailInfo.introductionDate }}</div>
            </div>
            <div class="equi-item">
              <span class="title">预计报废日期：</span>
              <div class="item">{{ detailInfo.expectedScrapDate }}</div>
            </div>
            <div class="equi-item">
              <span class="title">负责人：</span>
              <div class="item">{{ detailInfo.liableUserName }}</div>
            </div>
            <div class="equi-item">
              <span class="title">所属部门：</span>
              <div class="item">{{ detailInfo.deptName }}</div>
            </div>
            <div class="equi-item">
              <span class="title">是否计量设备：</span>
              <div class="item">
                {{ detailInfo.meteringDevice === 0 ? "否" : "是" }}
              </div>
            </div>
            <div class="equi-item">
              <span class="title">是否开启折旧：</span>
              <div class="item">
                {{ detailInfo.depreciationOpen === 0 ? "否" : "是" }}
              </div>
            </div>
            <div class="equi-item equi-item-big">
              <span class="title">净值：</span>
              <div class="item">{{ detailInfo.currentNetWorth }}</div>
            </div>
            <div style="width: 100%"></div>
            <div class="equi-item equi-item-big">
              <span class="title">设备地址：</span>
              <div
                class="item spec-item-long"
                title="中国上海浦东新区中心测试307西门子"
              >
              <img
                      class="acount-svg"
                      src="/images/acount2.png"
                    />
                中国上海浦东新区中心测试307西门子
              </div>
            </div>
            <div style="width: 100%"></div>
            <div class="equi-item equi-item-big">
              <span class="title">技术参数：</span>
              <div
                class="item spec-item-long"
                title="中国上海浦东新区中心测试307西门子"
              >
                中国上海浦东新区中心测试307西门子
              </div>
            </div>
            <div style="width: 100%"></div>
            <div class="equi-item equi-item-big">
              <span class="title">备注</span>
              <div
                class="item spec-item-long"
                title="中国上海浦东新区中心测试307西门子"
              >
                中国上海浦东新区中心测试307西门子
              </div>
            </div>
          </div>
          <div class="no-first-info-basic">
            <IconTitle title="计量信息" imgUrl="yunwei">
              <span class="slot">品牌管理</span>
            </IconTitle>
            <div class="equi-box">
              <div class="equi-item">
                <span class="title">计量编号</span>
                <div class="item">KYUAOA555550923876813</div>
              </div>
              <div class="equi-item">
                <span class="title">计量范围</span>
                <div class="item">KYUAOA00923876813</div>
              </div>
              <div class="equi-item">
                <span class="title">计量点位</span>
                <div class="item">KYUAOA00923876813</div>
              </div>
              <div class="equi-item">
                <span class="title">仪器精度</span>
                <div class="item">KYUAOA00923876813</div>
              </div>
              <div class="equi-item">
                <span class="title">允许误差</span>
                <div class="item">90</div>
              </div>
              <div class="equi-item">
                <span class="title">管理等级</span>
                <div class="item">99999</div>
              </div>
              <div class="equi-item">
                <span class="title">计量方式</span>
                <div class="item">台</div>
              </div>
              <div class="equi-item">
                <span class="title">下次计量日起</span>
                <div class="item">2021-11-12</div>
              </div>
              <div class="equi-item">
                <span class="title">计量周期</span>
                <div class="item">1周</div>
              </div>
              <div class="equi-item">
                <span class="title">提前提醒时间</span>
                <div class="item">1天</div>
              </div>

              <div class="equi-item">
                <span class="title">负责人</span>
                <div class="item">西门子</div>
              </div>
              <div class="equi-item">
                <span class="title">说明</span>
                <div class="item">西门子</div>
              </div>
            </div>
          </div>
        </div>
        <div class="info-basic no-first-info-basic">
          <IconTitle title="折旧信息" imgUrl="yunwei">
            <span class="slot">品牌管理</span>
          </IconTitle>
          <div class="equi-box">
            <div class="equi-item">
              <span class="title">使用寿命(月)</span>
              <div class="item">28</div>
            </div>
            <div class="equi-item">
              <span class="title">原值</span>
              <div class="item">30000.00</div>
            </div>
            <div class="equi-item">
              <span class="title">净残率(%)</span>
              <div class="item">5</div>
            </div>
            <div class="equi-item">
              <span class="title">折旧方法</span>
              <div class="item">平均年限法</div>
            </div>
            <div class="equi-item">
              <span class="title">月折旧额</span>
              <div class="item">756.353</div>
            </div>
          </div>
        </div>
      </div>
      <div class="image-box">
        <IconTitle title="设备图片" imgUrl="yunwei">
          <span class="slot">品牌管理</span>
        </IconTitle>
        <div class="image-box-mini">
          <el-image
            v-for="(item, index) in detailInfo.imgArray"
            :src="item.url"
            :preview-src-list="[item.url]"
          >
          </el-image>
        </div>
      </div>
    </div>
    <div class="info-table">
      <div class="table-box">
        <IconTitle title="设备相关文档" imgUrl="yunwei">
          <span class="slot">品牌管理</span>
        </IconTitle>
        <!-- 设备文档 -->
        <el-table
          :data="deviceData"
          border
          style="width: 100%"
          @selection-change="deviceSelectionChange"
        >
          <el-table-column type="selection" align="center" width="55" />
          <el-table-column prop="date" label="资料名称" align="center">
          </el-table-column>
          <el-table-column prop="name" label="资料类别" align="center">
          </el-table-column>
          <el-table-column prop="name" label="文档密级" align="center">
          </el-table-column>
          <el-table-column prop="address" label="文件数量" align="center">
          </el-table-column>
          <el-table-column prop="address" label="说明" align="center">
          </el-table-column>
        </el-table>
      </div>
      <div class="table-box">
        <IconTitle title="子设备" imgUrl="yunwei">
          <span class="slot">品牌管理</span>
        </IconTitle>
        <!-- 设备文档 -->
        <el-table
          :data="deviceData"
          border
          style="width: 100%"
          @selection-change="deviceSelectionChange"
        >
          <el-table-column type="selection" align="center" width="55" />
          <el-table-column prop="date" label="资料名称" align="center">
          </el-table-column>
          <el-table-column prop="name" label="资料类别" align="center">
          </el-table-column>
          <el-table-column prop="name" label="文档密级" align="center">
          </el-table-column>
          <el-table-column prop="address" label="文件数量" align="center">
          </el-table-column>
          <el-table-column prop="address" label="说明" align="center">
          </el-table-column>
        </el-table>
      </div>
      <div class="table-box">
        <IconTitle title="父设备" imgUrl="yunwei">
          <span class="slot">品牌管理</span>
        </IconTitle>
        <!-- 设备文档 -->
        <el-table
          :data="deviceData"
          border
          style="width: 100%"
          @selection-change="deviceSelectionChange"
        >
          <el-table-column type="selection" align="center" width="55" />
          <el-table-column prop="date" label="资料名称" align="center">
          </el-table-column>
          <el-table-column prop="name" label="资料类别" align="center">
          </el-table-column>
          <el-table-column prop="name" label="文档密级" align="center">
          </el-table-column>
          <el-table-column prop="address" label="文件数量" align="center">
          </el-table-column>
          <el-table-column prop="address" label="说明" align="center">
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>
<script>
import IconTitle from "@/components/icon-title/index.vue";
import {
  getSelectUseStatus,
  getSelectDeviceStatus,
  getSelectUnit,
} from "@/api/ems/equipment/account";
export default {
  name: "basic",
  components: {
    IconTitle,
  },
  data() {
    return {
      detailInfo: {},
      useStatusSelect: [],
      deviceStatusSelect: [],
      unitSelect: [],
      deviceData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
        },
      ],
    };
  },
  created() {
    getSelectUseStatus().then((res) => {
      this.useStatusSelect = res.data.data;
    });
    getSelectDeviceStatus().then((res) => {
      this.deviceStatusSelect = res.data.data;
    });
    getSelectUnit().then((res) => {
      this.unitSelect = res.data.data;
    });
  },
  mounted() {},
  methods: {
    getDetail(val) {
      this.detailInfo = val;
      if (this.detailInfo.status) {
        let statusItem = this.deviceStatusSelect.filter(
          (item) => item.value === this.detailInfo.status
        );
        this.detailInfo.status = statusItem[0].label;
      }
      if (this.detailInfo.useStatus) {
        let useStatusItem = this.useStatusSelect.filter(
          (item) => item.value === this.detailInfo.useStatus
        );
        this.detailInfo.useStatus = useStatusItem[0].label;
      }
      if (this.detailInfo.unit) {
        let unitItem = this.unitSelect.filter(
          (item) => item.value === this.detailInfo.unit
        );
        this.detailInfo.unit = unitItem[0].label;
      }
    },
    deviceSelectionChange() {},
  },
};
</script>
<style lang="scss" scoped>
@import "@/styles/color.scss";
@import "@/styles/mixin.scss";
.info-box {
  font-size: 12px;
  .info-image {
    display: flex;
    width: 100%;
    position: relative;
    .info-box {
      width: 75%;
      margin-right: 10px;
      .info-basic {
        padding: 10px 15px;
        border-radius: 4px;
        background: #fff;
        box-sizing: border-box;
        b {
          display: block;
          margin: 10px 0;
        }
        .tag-box {
          .el-tag {
            margin-right: 15px;
          }
        }
        .equi-box {
          width: 100%;
          margin-top: 10px;
          display: flex;
          flex-wrap: wrap;
          font-size: 12px;
          border-right: 1px solid rgba(236, 240, 244, 100);
          box-sizing: border-box;
          border-top: 1px solid rgba(236, 240, 244, 100);
          .equi-item {
            width: 50%;
            display: flex;
            align-items: center;
            border: 1px solid rgba(236, 240, 244, 100);
            border-top: 0;
            border-right: 0;
            box-sizing: border-box;
            .title {
              display: inline-block;
              width: 150px;
              padding: 10px;

              color: #666;
              border-right: 1px solid rgba(236, 240, 244, 100);
              box-sizing: border-box;
            }
            //有圈圈的item
            .spec-item {
              color: #000;
              padding: 10px;
              display: flex;
              align-items: center;
              .circle-blue {
                @include gradeCircle(10px, #498ae8);
              }
              .circle-green {
                @include gradeCircle(10px, #5ec28e);
              }
              .circle-purple {
                @include gradeCircle(10px, #7748d4);
              }
            }
            //一般的文字
            .item {
              padding: 10px;
              color: #000;
              word-wrap: break-word;
              text-overflow: ellipsis;
              white-space: nowrap;
              overflow: hidden;
            }
            //长度很长的文字
            .spec-item-long {
              color: #000;
              white-space: nowrap;
              display: flex;
               align-items: center;
              .acount-svg {
                display: inline-block;
                width: 18px;
                height: 18px;
                margin-right: 5px;
              }
            }
          }
          .equi-item-big {
            width: 100%;
          }
        }
        .equi-box:last-child {
          border-bottom: 0;
        }
      }
      .no-first-info-basic {
        margin-top: 10px;
      }
    }

    .image-box {
      position: absolute;
      height: 100%;
      top: 0;
      width: calc(100% - 75% - 10px);
      right: 0;
      padding: 10px 15px;
      border-radius: 4px;
      background: #fff;
      box-sizing: border-box;
      height: 100%;
      .image-box-mini {
        display: flex;
        flex-wrap: wrap;
        .el-image {
          width: calc(50% - 5px);
        }
        .el-image:nth(2n) {
          margin-left: 10px;
        }
      }
    }
  }
}
</style>